﻿using RestSharp;
using Ymatou.API.Common;
using Ymatou.Evaluate.Seller.Model.ApiModel.Response.Query;
using Ymatou.ServiceCenter;

namespace Ymatou.Evaluate.Seller.Model.ApiModel.Request.Query
{
    [Resource("evaluate.iapi.ymatou.com", "api/query/GetOrderProductsByName", Method.GET, ParameterBuildType.Json)]
    public class GetOrderProductsByNameRequest : BaseRequestModel<GetOrderProductsByNameResponse>
    {
        public override string ApiName { get { return "api/query/GetOrderProductsByName"; } }
        public override bool HttpGet { get { return true; } }

        /// <summary>
        /// 买手Id
        /// </summary>
        public int SellerId { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// 最大记录数
        /// </summary>
        public int? MaxCount { get; set; }

        public override void Validate()
        {
            const string errCode = "-1";
            if (SellerId <= 0)
            {
                throw new BussniessException(errCode, "非法卖家Id");
            }
            if (string.IsNullOrWhiteSpace(ProductName))
            {
                throw new BussniessException(errCode, "商品名称不能为空");
            }
            
            base.Validate();
        }
    }
}
